﻿
@{
    ViewBag.Title = "ProgressInfo";
    Layout = "~/Views/Shared/_MyLayout.cshtml";
}

<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>进度一览</legend>
</fieldset>
<form class="layui-form" enctype="multipart/form-data">
    <div class="layui-form-item">
        <label class="layui-form-label">搜索</label>
        <div class="layui-input-block">
            <input type="text" id="SearchText" name="Title1" required lay-verify="required" onkeypress="getKey()" placeholder="输入名称" class="layui-input" style="width:300px;float:left;">
            <input type="text" value="" style="display:none" />

            <label class="layui-form-label" style="width:40px;">类型</label>
            <div class="layui-input-inline" style="width:100px;">
                <select id="ProjectTypeSel" lay-filter="ProjectTypeSelFilter">
                    <option value="全部">全部</option>
                    <option value="用户工程">用户工程</option>
                    <option value="主业">主业</option>
                </select>
            </div>

            <label class="layui-form-label" style="width:40px;">年份</label>
            <div class="layui-input-inline" style="width:100px;">
                <select id="ProjectYearSel" lay-filter="ProjectYearFilter">
                    <option value="全部">全部</option>
                    @for (int i = 0; i < 10; i++)
                    {
                        <option value="@DateTime.Now.AddYears(1-i).ToString("yyyy")">@DateTime.Now.AddYears(1 - i).ToString("yyyy")</option>
                    }
                </select>
            </div>
            <button type="button" class="layui-btn layui-btn-normal" style="float:left;" onclick="SearchFunc()"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </div>
</form>
<hr />
<div id="Content">
    @for (int i = 0; i < ViewBag.ListInfo.Count; i++)
    {
        <div style="display:inline-block;width:100%">
            <div class="layui-card" style="width:600px;float:left">
                <div class="layui-card-header">
                    <span style="font-size:20px;font-weight:700;color:dimgray" >项目名称</span>
                    <span style="font-size:16px;cursor:pointer;" onclick="GoProcessSingle(@ViewBag.ListInfo[i]["ProjectId"])">@ViewBag.ListInfo[i]["Name"]</span>
                </div>
                <div class="layui-progress layui-progress-big" lay-showPercent="yes">
                    @{
                        double temp = 0;
                        int TotalNum = 0;
                        TotalNum = int.Parse(ViewBag.ListInfo[i]["YWC"].ToString()) + int.Parse(ViewBag.ListInfo[i]["JXZ"].ToString()) + int.Parse(ViewBag.ListInfo[i]["ZH"].ToString());
                        temp = TotalNum;
                        temp = double.Parse(ViewBag.ListInfo[i]["YWC"].ToString()) / temp * 100;
                     }
                    <div class="layui-progress-bar layui-bg-green" lay-percent="@temp.ToString("0")%"></div>
                </div>
            </div>

            <div class="layui-card" style="width:300px;float:left">
                <div class="layui-card-header">
                    <span style="font-size:20px;font-weight:700;color:dimgray">节点情况</span>
                    <span style="font-size:16px;margin-left:10px;">总数：</span>
                    <span style="font-size:16px;">@TotalNum</span>
                    <span style="margin-left:10px;font-size:16px;">@ViewBag.ListInfo[i]["ContrYear"]年</span>
                </div>
                <div style="margin-left:20px;">
                    <span style="margin-left:10px;font-size:16px;">已完成</span><span style="margin-left:10px;font-size:16px;">@ViewBag.ListInfo[i]["YWC"]</span>
                    <span style="margin-left:10px;font-size:16px;">进行中</span><span style="margin-left:10px;font-size:16px;">@ViewBag.ListInfo[i]["JXZ"]</span>
                    <span style="margin-left:10px;font-size:16px;">滞后</span><span style="margin-left:10px;font-size:16px;">@ViewBag.ListInfo[i]["ZH"]</span>
                </div>
            </div>
        </div>
    }



</div>




<script type="text/javascript">
    var table;
    layui.use(['form', 'table', 'upload', 'layer','element'], function () {
        var upload = layui.upload;
        table = layui.table;
        var form = layui.form;
        var tab = parent.tab;
        var layer = layui.layer;
        var element = layui.element;
        var index;



        form.on('select(StateSelFilter)', function (data) {
            StateSel = data.value;
            if (ProjectId == -1) {
                return;
            }
           


        });


    });


    //回车键
    function getKey() {
        if (event.keyCode == 13) {
            SearchFunc();
        }
    }

    function SearchFunc() {
        var text = $("#SearchText").val();
        var Condition = "";
        //类型条件
        var ProjectType = $("#ProjectTypeSel").val();
        if (ProjectType != "全部") {
            Condition += "&ProjectType=" + ProjectType;
        }
        var ProjectYear = $("#ProjectYearSel").val();
        if (ProjectYear != "全部") {
            Condition += "&ProjectYear=" + ProjectYear;
        }
        if (text == "") {
            window.location.href = "/Process/ProgressInfo?temp=1" + Condition;
        }
        else {
            window.location.href = "/Process/ProgressInfo?ProjectName=" + text + Condition;
        }
    }

    function GoProcessSingle(projectId) {
        var url = "/Process/ProcessInfoSingle?ProjectId=" + projectId;
        window.open(url, "_blank", "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no,width=1000px");
    }

</script>
